package com.jiyiren.bms.bean;

import com.jiyiren.bms.cons.ConstBattery;

/**
 * Created by yiji on 2016/11/5.
 * The info of battery
 */

public class BatteryInfo {
    double capacity;//容量 mAh
    int level;//current level
    int scale;//total level

    int health;//ex: cold dead good overheat over_voltage unknown unspecified_failure
    int plugged;//plugged device type: AC USB WIRELESS
    int status; //ex: charging discharging full not_charging unknown

    String technology;//ex: Li-ion
    int voltage; //unit: mV = V/1000
    int temperature;//unit: C/10

    public BatteryInfo(){

    }

    public double getCapacity() {
        return capacity;
    }

    public void setCapacity(double capacity) {
        this.capacity = capacity;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getScale() {
        return scale;
    }

    public void setScale(int scale) {
        this.scale = scale;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    public int getPlugged() {
        return plugged;
    }

    public void setPlugged(int plugged) {
        this.plugged = plugged;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getTechnology() {
        return technology;
    }

    public void setTechnology(String technology) {
        this.technology = technology;
    }

    public int getVoltage() {
        return voltage;
    }

    public void setVoltage(int voltage) {
        this.voltage = voltage;
    }

    public int getTemperature() {
        return temperature;
    }

    public void setTemperature(int temperature) {
        this.temperature = temperature;
    }

    @Override
    public String toString() {
        return "BatteryInfo{" +
                "capacity=" + capacity +
                ", level=" + level +
                ", scale=" + scale +
                ", health=" + health +
                ", plugged=" + plugged +
                ", status=" + status +
                ", technology='" + technology + '\'' +
                ", voltage=" + voltage +"mV"+
                ", temperature=" + temperature +
                '}';
    }

    public String convertToString(){
        return "BatteryInfo{" +
                "capacity=" + capacity +
                ", curpercent=" + level/scale*100 +
                ", health=" + ConstBattery.getHealthString(health) +
                ", plugged=" + ConstBattery.getPlugTypeString(plugged) +
                ", status=" + ConstBattery.getStatusString(status) +
                ", technology='" + technology + '\'' +
                ", voltage=" + voltage/1000+"V" +
                ", temperature=" + temperature/10+"℃" +
                '}';
    }
}
